import * as util from "@/common/util";
import * as API from "@/api/axios";

export default {
    // 财务概览-伙伴提现
    getPage: (params, page) => {
        const url = util.replacePageNumAndSize('/manage/withdraws/{pageNum}/{pageSize}', page)
        return API.axiosGetAPI(url, params)
    },

    //提现-统计
    getTotal: (params) => {
        return API.axiosGetAPI('/manage/withdraws/summary', params);
    },

    //提现-详情
    getDetail: (id) => {
        return API.axiosGetAPI(`/manage/withdraws/${id}`);
    },

    //提现-导出
    getExportWithdraws: (params) => {
        const headers = {
            'content-Type': 'application/x-www-form-urlencoded',
            'lang-key': 'exports'
        }
        return API.axiosPostAPI(`/manage/withdraws/export?state=${params.state}&type=${params.type}&rangeTime=${params.rangeTime}&search=${params.search}&variableTitleHead=${params.variableTitleHead}`, null, headers, {
            responseType: 'blob'
        });
    },

    // 通过/拒绝
    withdrawsAudit: (params) => {
        const headers = {
            'lang-key': params.state == 1 ? 'branch_Pass' : 'branch_Reject'
        }
        return API.axiosPutAPI(`/manage/withdraws`, params,headers)
    },

    // 财务概览-代理商账单收益统计
    getAgentTotal: () => {
        return API.axiosGetAPI(`/manage/brokerages/billing-statistics`);
    },

    // 财务概览-代理商账单列表
    getBillingList: (params, page) => {
        const url = util.replacePageNumAndSize('/manage/brokerages/billing/{pageNum}/{pageSize}', page)
        return API.axiosGetAPI(url, params)
    },

    // 财务概览-代理商提现
    agentWithdraw: (params) => {
        return API.axiosGetAPI(`/manage/brokerages/withdraw`, params);
    },

    // 财务概览-代理商提现记录
    getBillingRecord: (params, page) => {
        const url = util.replacePageNumAndSize('/manage/brokerages/withdraw/{pageNum}/{pageSize}', page)
        return API.axiosGetAPI(url, params)
    },

}